package com.gl.controller;


import com.gl.service.StatisticsDailyService;
import com.gl.utils.CommonResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

/**
 * <p>
 * 网站统计日数据 前端控制器
 * </p>
 *
 * @author testjava
 * @since 2020-12-14
 */
@RestController
@RequestMapping("/statistics")
public class StatisticsDailyController {

    @Autowired
    private StatisticsDailyService statisticsDailyService;


    //统计某一天的数据
    @GetMapping("statisticsDay/{day}")
    public CommonResponse statisticsDay(@PathVariable String day){
        statisticsDailyService.statisticsDay(day);

        return CommonResponse.ok();
    }

    //统计某一段时间的图表数据
    @GetMapping("statisticsChart/{begin}/{end}")
    public CommonResponse statisticsChart(@PathVariable String begin,@PathVariable String end){
        Map<String,Object> map = statisticsDailyService.statisticsChart(begin,end);

        return CommonResponse.ok().data(map);
    }


}

